package com.titaniume.activitiweb.controller;

import com.titaniume.activitiweb.mapper.ActivitiMapper;
import com.titaniume.activitiweb.util.AjaxResponse;
import com.titaniume.activitiweb.util.GlobalConfig;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;


/**
 * @ProjectName: activiti7_workflow
 * @Package: com.titaniume.activitiweb.controller
 * @ClassName: UserController
 * @Author: huangrenfei
 * @Description:
 * @Date: 2021/11/19 15:08
 * @Version: 1.0
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private ActivitiMapper activitiMapper;


    //获取用户列表
    @GetMapping(value = "/getUers")
    public AjaxResponse getUers() {
        try {
            List<HashMap<String, Object>> userList = activitiMapper.selectUser();
            return AjaxResponse.AjaxData(GlobalConfig.ResponseCode.SUCCESS.getCode(),
                    GlobalConfig.ResponseCode.SUCCESS.getDesc(),
                    userList);
        } catch (Exception e) {
            return AjaxResponse.AjaxData(GlobalConfig.ResponseCode.ERROR.getCode(),
                    "获取用户列表失败",
                    e.toString());
        }
    }
}
